package com.own.business.system.menu.entity.bo;

import com.own.business.system.menu.entity.po.SystemRolePermission;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * SystemRolePermissionBo
 *
 * @author chenxueli
 * @date 2024-03-31 09:22:58
 */
@Schema(title = "系统角色权限" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemRolePermissionBo extends BaseBo<SystemRolePermission> implements Serializable {

    /**
     * 角色id
     */
    private Long roleId;

    /**
     * 菜单id
     */
    private Long menuId;

    /**
     * 权限标识
     */
    private String permission;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemRolePermission toPo(SystemRolePermission entity) {
        if (entity == null) {
            entity = new SystemRolePermission();
        }
        entity.setFkRoleId(this.roleId);
        entity.setFkMenuId(this.menuId);
        entity.setPermission(this.permission);
        return super.toPo(entity);
    }

}

